package com.xbongbong.pro.smartsettings.pojo.dto;

import com.xbongbong.paas.domain.entity.ext.ConditionsEntityExt;
import com.xbongbong.paas.domain.entity.ext.OptionalRangeEntity;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.pro.enums.smartsettings.enums.SmartActionTypeEnum;
import com.xbongbong.pro.smartsettings.pojo.AiTriggerConditionLogPojo;
import com.xbongbong.pro.smartsettings.pojo.SmartFieldAttrPojo;
import com.xbongbong.pro.smartsettings.pojo.SmartStrategyPojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @description: 保存设置
 * @Author: hongxiao
 * @date: 2019-04-23 21:09
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class SmartSettingsSaveDTO extends BaseDTO {
    /**
     * 智能助手id
     */
    private Long id;
    /**
     * 智能助手名称
     */
    @NotBlank(message = "{dto.msg.smartSettingsSave.name.NotBlank}")
    @Length(max = 15, message = "{dto.msg.smartSettingsSave.name.Length}")
    private String name;
    /**
     * 应用id
     */
    private Long appId;
    /**
     * paas菜单id
     */
    private Long menuId;
    /**
     * 表单id
     */
    @NotNull(message = "{dto.msg.smartSettingsSave.formId.NotNull}")
    private Long formId;
    /**
     * saas或paas标识，1:saas,2:paas
     * @see com.xbongbong.pro.enums.SaasMarkEnum
     */
    @NotNull(message = "{dto.msg.smartSettingsSave.saasMark.NotNull}")
    @Range(min = 1, max = 2, message = "{dto.msg.smartSettingsSave.saasMark.Range}")
    private Integer saasMark;
    /**
     * 业务类型
     * @see com.xbongbong.saas.enums.XbbRefTypeEnum
     */
    private Integer businessType;
    /**
     * 触发条件
     */
    @Size(max = 3, message = "{dto.msg.smartSettingsSave.triggerCondition.Size}")
    private List<ConditionsEntityExt> triggerCondition;
    /**
     * 执行动作,1消息，2短信，3新增访客，4新增任务
     * @see SmartActionTypeEnum
     */
    @NotNull(message = "{dto.msg.smartSettingsSave.action.NotNull}")
    @Range(min = 1, max = 4, message = "{dto.msg.smartSettingsSave.action.Range}")
    private Integer action;
    /**
     * 执行策略
     */
    @NotNull(message = "{dto.msg.smartSettingsSave.strategy.NotNull}")
    @Valid
    private SmartStrategyPojo strategy;
    /**
     * 执行人
     */
    private List<OptionalRangeEntity> executor;
    /**
     * 短信执行人
     */
    private List<SmartFieldAttrPojo> smsExecutor;
    /**
     * 执行详情
     */
    @NotBlank(message = "{dto.msg.smartSettingsSave.memo.NotBlank}")
    @Length(max = 20, message = "{dto.msg.smartSettingsSave.memo.Length}")
    private String memo;

    /**
     * 日志用：旧触发条件
     */
    private List<AiTriggerConditionLogPojo> oldTriggerCondition;
    /**
     * 日志用：新触发条件
     */
    private List<AiTriggerConditionLogPojo> newTriggerCondition;
}
